﻿using System.ComponentModel;

namespace TorrentProxy
{
	class Settings: BaseSettings
	{

		[SettingItem("Port")]
		[DefaultValue(8090)]
		public int Port
		{
			get
			{
				return this["Port"].As<int>();
			}
			set
			{
				this["Port"] = value;
			}
		}

		[SettingItem("RunOnLogon")]
		[DefaultValue(true)]
		public bool RunOnLogon
		{
			get
			{
				return this["RunOnLogon"].As<bool>();
			}
			set
			{
				this["RunOnLogon"] = value;
			}
		}

		[SettingItem("RunProxyOnLogon")]
		[DefaultValue(true)]
		public bool RunProxyOnLogon
		{
			get
			{
				return this["RunProxyOnLogon"].As<bool>();
			}
			set
			{
				this["RunProxyOnLogon"] = value;
			}
		}

		[SettingItem("RunMinimized")]
		[DefaultValue(true)]
		public bool RunMinimized
		{
			get
			{
				return this["RunMinimized"].As<bool>();
			}
			set
			{
				this["RunMinimized"] = value;
			}
		}

		[SettingItem("LeechingMode")]
		[DefaultValue(LeechingMode.Override)]
		public LeechingMode LeechingMode
		{
			get
			{
				return this["LeechingMode"].As<LeechingMode>();
			}
			set
			{
				this["LeechingMode"] = value;
			}
		}

		[SettingItem("LeechingModeOverrideMinRatio")]
		[DefaultValue(0.9f)]
		public float LeechingModeOverrideMinRatio
		{
			get
			{
				return this["LeechingModeOverrideMinRatio"].As<float>();
			}
			set
			{
				this["LeechingModeOverrideMinRatio"] = value;
			}
		}

		[SettingItem("LeechingModeOverrideMaxRatio")]
		[DefaultValue(1.1f)]
		public float LeechingModeOverrideMaxRatio
		{
			get
			{
				return this["LeechingModeOverrideMaxRatio"].As<float>();
			}
			set
			{
				this["LeechingModeOverrideMaxRatio"] = value;
			}
		}

		[SettingItem("LeechingModeIncreaseMinRatio")]
		[DefaultValue(1.2f)]
		public float LeechingModeIncreaseMinRatio
		{
			get
			{
				return this["LeechingModeIncreaseMinRatio"].As<float>();
			}
			set
			{
				this["LeechingModeIncreaseMinRatio"] = value;
			}
		}

		[SettingItem("LeechingModeIncreaseMaxRatio")]
		[DefaultValue(1.3f)]
		public float LeechingModeIncreaseMaxRatio
		{
			get
			{
				return this["LeechingModeIncreaseMaxRatio"].As<float>();
			}
			set
			{
				this["LeechingModeIncreaseMaxRatio"] = value;
			}
		}

		[SettingItem("SeedingModeMinRatio")]
		[DefaultValue(1f)]
		public float SeedingModeMinRatio
		{
			get
			{
				return this["SeedingModeMinRatio"].As<float>();
			}
			set
			{
				this["SeedingModeMinRatio"] = value;
			}
		}

		[SettingItem("SeedingModeMaxRatio")]
		[DefaultValue(1f)]
		public float SeedingModeMaxRatio
		{
			get
			{
				return this["SeedingModeMaxRatio"].As<float>();
			}
			set
			{
				this["SeedingModeMaxRatio"] = value;
			}
		}

		[SettingItem("DecreaseDownloadedTraffic")]
		[DefaultValue(false)]
		public bool DecreaseDownloadedTraffic
		{
			get
			{
				return this["DecreaseDownloadedTraffic"].As<bool>();
			}
			set
			{
				this["DecreaseDownloadedTraffic"] = value;
			}
		}

		[SettingItem("DecreaseDownloadedTrafficRatio")]
		[DefaultValue(0f)]
		public float DecreaseDownloadedTrafficRatio
		{
			get
			{
				return this["DecreaseDownloadedTrafficRatio"].As<float>();
			}
			set
			{
				this["DecreaseDownloadedTrafficRatio"] = value;
			}
		}
	}

	public enum LeechingMode
	{
		Override,
		Increase
	}
}
